/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


package multiplayer;

import Entities.Scene;
import Visitor.IVisitor;
import Visitor.PaintVisitor;
import java.awt.Graphics;
import java.util.logging.Level;
import java.util.logging.Logger;


public class RendererCliente1 extends Thread implements Renderer{
    private PanelPrincipal panelPrincipal;
    private Boolean stop;
    private Scene scene;
    
    public RendererCliente1 (PanelPrincipal panelPrincipal, Scene scene){
        this.panelPrincipal = panelPrincipal;
        stop = false;
        this.scene = scene;
    }

    @Override
    public void execute() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    @Override
    public void run() {
        Graphics g = panelPrincipal.getImage().getGraphics();
        while (!stop) {
            try {
                g.clearRect(0, 0, 400, 300);
                IVisitor paintVisitor = new PaintVisitor(g);
                scene.accept(paintVisitor);
                
                panelPrincipal.repaint();
                Thread.sleep(15);
            } catch (InterruptedException ex) {
                Logger.getLogger(Renderer.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

}
